<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@include file="../common/head.jsp"%>
<div class="right">
    <div class="location">
        <strong>你现在所在的位置是:</strong>
        <span>用户管理页面 >> 用户修改页面</span>
    </div>
    <div class="providerAdd">
        <form id="userForm" name="userForm" method="post" action="user/doModify">
            <input type="hidden" name="userId" value="${ requestScope.user.userId}"/>
            <div>
                <label for="userName">用户名称：</label>
                <input type="text" name="userName" id="userName" value="${ requestScope.user.userName }">
                <font color="red"></font>
            </div>
            <div>
                <label >用户性别：</label>
                <select name="gender" id="gender">
                    <c:choose>
                        <c:when test="${ requestScope.user.gender == 1 }">
                            <option value="1" selected="selected">男</option>
                            <option value="2">女</option>
                        </c:when>
                        <c:otherwise>
                            <option value="1">男</option>
                            <option value="2" selected="selected">女</option>
                        </c:otherwise>
                    </c:choose>
                </select>
            </div>
            <div>
                <label for="birthday">出生日期：</label>
                <fmt:formatDate value="${requestScope.user.birthday }" var="birthday" pattern="yyyy-MM-dd"></fmt:formatDate>
                <input type="text" Class="Wdate" id="birthday" name="birthday" value="${birthday}">
                <font color="red"><form:errors path="birthday"/></font>
            </div>

            <div>
                <label for="phone">用户电话：</label>
                <input type="text" name="phone" id="phone" value="${ requestScope.user.phone }">
                <font color="red"></font>
            </div>
            <div>
                <label for="address">用户地址：</label>
                <input type="text" name="address" id="address" value="${ requestScope.user.address }">
            </div>
            <div>
                <label >用户角色：</label>
                <!-- 列出所有的角色分类 -->

                <select name="userRole" id="userRole">
                    <c:forEach items="${requestScope.roleList}" var="role">
                        <option <c:if test="${role.roleId == requestScope.user.userRole}">selected</c:if> value="${role.roleId}">${role.roleName}</option>
                    </c:forEach>
                </select>
                <font color="red"></font>
            </div>
            <div class="providerAddBtn">
                <input type="submit"  name="save" id="save" value="保存" />
                <input type="button" onclick="history.back()" id="back" name="back" value="返回"/>
            </div>
        </form>
    </div>
</div>
</section>
<%@include file="../common/foot.jsp" %>
